package com.xy.blog.article.domain.controller;

import com.xy.blog.article.api.ArticlePicService;
import com.xy.blog.article.domain.service.IArticleService;
import com.xy.blog.core.springmvc.controller.BaseController;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author zanhonglei
 * @version V1.0
 * @Description:
 * @date 2020/5/27
 */
@Api(value = "ArticlePicController",tags = "文章图片")
@RestController
public class ArticlePicController extends BaseController implements ArticlePicService {

    @Autowired
    private IArticleService articleServiceImpl;

    @Override
    public Object picUpload(MultipartFile file) {
        return getData(articleServiceImpl.upload(file));
    }

    @Override
    public ResponseEntity<byte[]> download(Long picId) {
        return articleServiceImpl.download(picId);
    }

}
